package com.finna.tenant.service;

import com.alibaba.fastjson.JSON;
import com.finna.common.utils.ResponseResult;
import com.finna.tenant.controller.TenantController;
import com.finna.tenant.dto.TenantDTO.TenantCreateRequest;
import com.finna.tenant.dto.TenantDTO.TenantResponse;
import com.finna.tenant.mapper.TenantMapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@Slf4j
@SpringBootTest
public class TenantTest {

    @Resource
    private TenantMapper tenantMapper;
    @Resource
    private TenantController tenantController;

    @Test
    public void testCreateTenant() {
        TenantCreateRequest request = TenantCreateRequest.builder()
                .name("测试租户")
                .status(1)
                .isAdmin(true)
                .isPublic(true)
                .build();
        ResponseResult<TenantResponse> tenantResponseResponseResult = tenantController.addTenant(request);
        log.info("测试结果：{}", JSON.toJSONString(tenantResponseResponseResult));
    }
}
